<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title></title>
    <%@ include file="/WEB-INF/include/commoncss.jsp"%>
    <script type="text/javascript"
            src="${ctx}/javascript/laydate/laydate.js"></script>
</head>
<body>
<article class="page-container">
    <div action="" class="form form-horizontal" id="scheduleAdd">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span
                    class="c-red">*</span>国家代码：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input id="country_code" name="country_code" value="" class="input-text" />
            </div>

        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">统计报表：</label>
            <div class="formControls col-xs-8 col-sm-3">
                <input placeholder="用逗号隔开" type="text" name="statistics" id="statistics" class="input-text" value=""/>
            </div>
            <label class="form-label col-xs-4 col-sm-2">相关文献：</label>
            <div class="formControls col-xs-8 col-sm-3">
                <input placeholder="用逗号隔开" type="text" name="conferences" id="conferences" class="input-text" value=""/>
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">科技政策：</label>
            <div class="formControls col-xs-8 col-sm-3">
                <textarea id="science_technology_policy" name="science_technology_policy" cols="130" rows="5"></textarea>
            </div>

        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">科技队伍：</label>
            <div class="formControls col-xs-8 col-sm-3">
                <textarea id="technology_agency" name="technology_agency" cols="130" rows="5" value="" ></textarea>
            </div>

        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">主要智库：</label>
            <div class="formControls col-xs-8 col-sm-3">
                <textarea id="think_tank" name="think_tank" cols="130" rows="5" value="" >${technology.think_tank}</textarea>
            </div>

        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">教育制度：</label>
            <div class="formControls col-xs-8 col-sm-3">
                <textarea id="educational_scheme" name="educational_scheme" cols="130" rows="5" value="" ></textarea>
            </div>

        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">知名学府：</label>
            <div class="formControls col-xs-8 col-sm-3">
                <textarea id="university" name="university" cols="130" rows="5" value="" ></textarea>
            </div>

        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">
                <span class="c-red">*</span>来源：</label>
            <div class="formControls col-xs-8 col-sm-3">
                <textarea id="reference" name="reference" cols="130" rows="5" value="" ></textarea>
            </div>

        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">图片上传：</label>
            <%--//带文本框--%>
            <div class="formControls">
        <span class="btn-upload form-group" style="margin-left: 15px;">
                <input class="input-text upload-url radius" type="text" name="uploadfile-1" id="uploadfile-1" readonly><a  class="btn btn-primary radius"><i class="Hui-iconfont">&#xe642;</i> 选择图片</a>
               <input type="file" multiple name="file-1" class="input-file" id="uploadFiles">
        </span>
            </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8  col-xs-offset-5 ">
                <button value="" type="button" class="btn btn-success radius" onClick="update_technology(this.value)">提交</button>
                &nbsp;&nbsp;&nbsp;&nbsp;
                <button id="close" value="${technology.recoder_id}" onClick="layer_close();" class="btn btn-default radius" type="button"> 关闭</button>
            </div>
        </div>
    </div>
    <%@ include file="/WEB-INF/include/commonjs.jsp"%>
    <script>
        function update_technology(value){
            var recorder=document.getElementById("close").value;
            var YHZH=parent.parent.document.getElementById("YHZH").innerText;
            if(YHZH.substring(0,3)!='001'&&YHZH.substring(0,3)!=recorder){
                layer.msg("你不能修改不是别人的内容只能查看",{icon:2,time:2000});
                return;
            }
            var conferences=document.getElementById("conferences").value;
            var statistics=document.getElementById("statistics").value;
            var country_code=document.getElementById("country_code").value;
            var science_technology_policy=document.getElementById("science_technology_policy").value;
            var technology_agency=document.getElementById("technology_agency").value;
            var think_tank=document.getElementById("think_tank").value;
            var educational_scheme=document.getElementById("educational_scheme").value;
            var university=document.getElementById("university").value;
            var refrence=document.getElementById("reference").value;

            if(country_code==null||country_code==""||refrence==""||refrence==null){
                layer.msg("*为必填项",{icon:2,time:2000});
                return;
            }
            var formData=new FormData();
            if($("#uploadFiles")[0].files.length>3){
                layer.msg("上传图片最多三张",{icon:2,time:2000});
                return;
            }else{
                for(var i=0;i<$("#uploadFiles")[0].files.length;i++){
                    formData.append("picture",$("#uploadFiles")[0].files[i]);
                }
            }
            layer.confirm("确认提交吗",{btn:['确定','取消']},function(){

                var url="${ctx}/Technology/technology_add.do";
//                var parameter={statistics:statistics,conferences:conferences,science_technology_policy:science_technology_policy,technology_agency:technology_agency,think_tank:think_tank,
//                    educational_scheme:educational_scheme
//                    ,university:university,refrence:refrence,country_code:country_code};
                formData.append("statistics",statistics);
                formData.append("conferences",conferences);
                formData.append("science_technology_policy",science_technology_policy);
                formData.append("technology_agency",technology_agency);
                formData.append("think_tank",think_tank);
                formData.append("educational_scheme",educational_scheme);
                formData.append("university",university);
                formData.append("refrence",refrence);
                formData.append("country_code",country_code);

                $.ajax({
                    url:url,
                    type:"post",
                    data: formData,
                    async:false,
                    xhrFields: {
                        withCredentials: true
                    },
                    cache: false,
                    contentType: false,
                    processData: false,
                    // dataType : "json",
                    scriptCharset: 'utf-8',
                    success:function (data) {
                        if(data=="添加成功"){
                            layer.msg(data,{icon:1,time:2000},function(){
                                parent.location.reload(true);
                            })
                        }else{
                            layer.msg(data,{icon:2,time:2000});
                        }
                    },
                    error:function (data) {
                        alert("服务器处理失败！");
                    }
                })//ajax

//                $.post(url,parameter,function(data){
//                    if(data=="添加成功"){
//                        layer.msg(data,{icon:1,time:2000},function(){
//                            parent.location.reload(true);
//                        })
//                    }else{
//                        layer.msg(data,{icon:2,time:2000});
//                    }
//                })
            })
        }

    </script>
</article>


</body>

</html>